using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;

public class SetPanel : MonoBehaviour
{
    public Button canelButton, voiceOn, voiceOff;
    public Text totalScoreText, totalStarText, bestScoreText, levelText;
    public GameObject setPanel, ball;
    public Animator animator;

    void Start()
    {
        totalScoreText.text = PlayerPrefs.GetInt(Const.TotalScore).ToString();
        totalStarText.text = PlayerPrefs.GetInt(Const.TotalStar).ToString();
        levelText.text = PlayerPrefs.GetInt(Const.Level, 1).ToString();
        bestScoreText.text = PlayerPrefs.GetInt(Const.BestScore).ToString();
        animator.Play("SetPanelShowScore");


    }

    public void OnCanelClick()
    {
        setPanel.SetActive(false);
        Time.timeScale = 1;
    }

    public void OnVoiceClick()
    {
        voiceOn.gameObject.SetActive(false);
        voiceOff.gameObject.SetActive(true);
        ball.GetComponent<AudioSource>().enabled = false;
    }

    public void OffVoiceClick()
    {
        voiceOn.gameObject.SetActive(true);
        voiceOff.gameObject.SetActive(false);
        ball.GetComponent<AudioSource>().enabled = true;
    }
}
